/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package requeteur;

import java.util.ArrayList;
import model.DBWriter;

/**
 *
 * @author Nargisse
 */
public class Paragraphe implements Comparable<Paragraphe> {
    private int idParagraphe;
    private double poids;
    private String xpath;
    private String document;
    private int docId;
    
    public Paragraphe(int id, double poids, DBWriter db){
       this.idParagraphe = id;
       this.poids = poids;
       this.xpath = db.getXPathFromNode(id);
    }
    
        public Paragraphe(int id, double poids){
       this.idParagraphe = id;
       this.poids = poids;
       this.xpath=null;
    }
    
    public int getIdParagraphe(){
        return this.idParagraphe;
    }
    
    public double getPoidsParag(){
        return this.poids;
    }
    
    public void setXPathWithBD(DBWriter db) {
        this.xpath=db.getXPathFromNode(this.idParagraphe);
    }
    
    public String getXPath(){
        return this.xpath;
    }
    public int getDocId() {
        return this.docId;
    }
    public void setDocumentIdWithBD(DBWriter db) {
        this.docId = db.getDocIdFromNode(this.idParagraphe);
    }

    @Override
    public int compareTo(Paragraphe o) {
        if (this.poids>=o.poids) {
            return -1;
        } else {
            return 1;
        }
    }
  
}
